package com.voc.im.present;

import com.voc.im.view.BaseView;
import io.reactivex.disposables.CompositeDisposable;

public class BasePresenter<V extends BaseView> {

    private CompositeDisposable disposable;

    private V view;

    public BasePresenter(V view) {
        this.view = view;
    }

    public CompositeDisposable disposable() {
        if (disposable == null) {
            disposable = new CompositeDisposable();
        }
        return disposable;
    }

    public void attachView(V view) {
        this.view = view;
    }

    public void detachView() {
        this.view = null;
    }

    public V view() {
        return view;
    }
}
